<%--
    Document   : addv030
    Created on : Jul 30, 2012, 3:14:19 PM
    Author     : ems
--%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="../css/popup.css"/>
        <link rel="stylesheet" type="text/css" href="../css/jquery.fancybox-1.3.4.css"/>
        <link rel="stylesheet" type="text/css" href="../css/kapiform.css"/>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/kapi.js"></script>

    </head>
    <script type="text/javascript" language="javascript">
        var open_cur = 0;
        $j = jQuery.noConflict();
        $j(document).ready(function(){
            showGlobalReport();
            swapMenu();
           
        });
               
    </script>    
    <script type="text/javascript">
        var open_cur = 0;
        $j = jQuery.noConflict();
        $j(document).ready(function(){
             
                
            $j(".name_map").live("mouseover",function(){
               
                $j(this).find(".name_map_delete").css("display","block");
                $j(this).find(".keyname").css({"background":"#A0CCF7"," border-radius":"4px","padding":"2px"});
            });
            $j(".name_map").live("mouseout",function(){
                $j(this).find(".name_map_delete").css("display","none");
                $j(this).find(".keyname").css({"background":"none"," border-radius":"none","padding":"0px"});
            });
           
            $j(".name_map_delete").live("click",function(){
                key = $j(this).attr("lang");
                $j.post("mailInput.jsp?action=come_person&key="+key,function(data){
                    if(data != null) {
                        $j("#"+key).remove();
                    }
                });
            });

            $j('.keysearch').live('keyup',function(){
                $j('.rich-table-row').hide();
                $j('.rich-table-row').each(function(){
                    html = $j(this).html();
                    // alert( ununicode(html));  || html.indexOf( $j('.keysearch').val()) > -1
                    if(   html.indexOf( $j('.keysearch').val()) > -1    )  {
                        $j(this).show();
                    }else{
                        $j(this).hide();
                    }

                });
            });
            $j("#fancybox-close").live("click",function(){
//                alert('aaaaaaaaaaaaaaaaaaa');
//                widows.location.href="mail.jsp?action=clear";
                window.location.href="mail.jsp?action=clear";   
            });

        });


    </script>
    <style type="text/css">
        .menu-header{
            float:left;
            height:20px;
            width:auto;
            margin-left:20px;
            padding:2px 20px;
            font-weight: bold;
            cursor:pointer;
            background: #2C3945;
            color:white;
        }
        .person{
            overflow: auto;

            border: 1px silver solid;
        }

        label{font-size:12px; text-align: right !important;}
        option{font-size:12px;}
        .rich-inslider-track{width:178px;}

        .menu-header a {
            font-weight: bold;
        }

        .menu-header a:link {
            color: #ffffff;
            text-decoration: none;
        }
        .menu-header a:visited {
            color: #ffffff;
            text-decoration: none;
        }
        .menu-header a:hover {
            color: #ffffff;
            text-decoration: none;
        }
        .menu-header a:active {
            color: #ffffff;
            text-decoration: none;
        }
        .come_person{
            border: 1px solid #EAE9E8;
            float: left;
            display: table;
            margin-top: 4px;
            height: 23px;
            padding-left: 14px;
            padding-top: 6px;
            width: 548px;

        }
        .name_map{
            float: left;
            font-size: 12px;
            padding:4px;
            position: relative;
        }
        .name_map .keyname:hover{
            background: none repeat scroll 0 0 #A0CCF7;
            border-radius: 4px;
            padding: 2px;

        }
        .name_map_delete{
            background: url("../images/delete_1.png") repeat scroll 0 0 transparent;
            height: 15px;
            position: absolute;
            right: 0;
            top: 0;
            width: 16px;
            display: none;

        }
        .group_mail{
            float:left;
            width:300px;
        }
        .send_to{
            margin-top:5px ;
        }
        .group_mail_right{
            float: right;
            margin-right: 44px;
            width: 300px;
        }
        .popup-content .main_content .form_item_content {
            float: left;
            height: 340px;
            margin-left: 10px;
            margin-top: 21px;
            overflow: auto;
            width: 100%;
        }


    </style>
    <f:view>
        <h:panelGroup rendered="#{loginSession.login.showGlobalMessage}">
            <center style="width: 100%">
                <div id="globalReport" class="globalReport">
                    <p style="padding-top: -5px;"><h:outputText value="#{loginSession.login.globalMessage}"/></p>
                </div>
            </center>
        </h:panelGroup>
        <a4j:form id="mapform">
            <body style=" float:left; width:auto; height:auto; margin:0px;overflow: hidden;">
                <f:loadBundle basename="#{environmentSession.localizationSource}" var="locale"/>

                <div class="popup" style="height:420px; width:760px;background:white;margin-top:13px; margin-right: 12px ">
                    <div class="popup-header">
                        <div class="title"><h:outputText value="#{locale.send_mail}" style="text-transform:uppercase"/></div>
                        <div style=" position: fixed; float:left; height:50px;width:50px;left:708px;">
                            <a id="fancybox-close" onclick="self.parent.tb_remove()"  style="display: block; float:left;"></a>
                        </div>
                    </div>
                    <div class="popup-content">
                        <div class="main_content">
                            <div class="form_item_content" style="margin-top:5px;margin-left: -1px;">
                                <div class="group_mail">
                                    <div class="fields_input">
                                        <label><h:outputText value="Mail"/>*:</label>
                                        <h:selectOneMenu value="" style="font-size:12px;">
                                            <f:selectItem itemLabel="Queenb Mail" itemValue="1"/>
                                            <f:selectItem itemLabel="Gmail" itemValue="1"/>
                                            <f:selectItem itemLabel="Yahoo Mail" itemValue="1"/>

                                        </h:selectOneMenu>
                                        <%--  <div class="" style="float:left;color:#196EC4;top:100;font-size:12px;margin-left:560px;position: absolute;margin-top:38px;">Ngày gửi:   <h:outputText value="#{m575Bean.md580}"/></div>--%>
                                    </div>
                                </div>
                                    <label style="margin-top:8px;display:none;width:69px;"><h:outputText value="Người gửi:"/>*:</label>
                                    <h:inputText value="" style="display:none;float:right;margin-right:73px;margin-top:8px;"/>
                                    <h:selectOneMenu  value="#{m575Bean.fq100}" style="float:right;width:146px;height:23px;font-size:12px;margin-top:5px;margin-right:72px;" styleClass="person" >
                                        <f:selectItem itemValue="0" itemLabel="#{locale.select_receiver}"/>
                                        <f:selectItem itemValue="-1" itemLabel="Tất cả"/>
                                        <f:selectItems value="#{m575Bean.selectItemQ100}"/>
                                        <a4j:support event="onchange" reRender="tofrom,mapenty,mapform" actionListener="#{m575Bean.actionListenner}"/>
                                    </h:selectOneMenu>
                                <%--
                            <div class="group_mail_right">
                                <div class="fields_input">
                                    <label><h:outputText value="#{locale.project}"/>*:</label>
                                    <h:selectOneMenu value="#{m575Bean.fb050}" style="font-size:12px;width:146px;">
                                        <f:selectItems value="#{m575Bean.selectItemB050}"/>
                                    </h:selectOneMenu>
                                   
                                </div>
                            </div>--%>
                                <div class="fields_input" style="height: 60px !important; overflow: auto">
                                    <label style="margin-top:4px; "><h:outputText value="#{locale.send_to}"/>*:</label>
                                    <div class="come_person" >
                                        <a4j:repeat value="#{m575Bean.listSendMail}" var="keys" id="mapenty">
                                            <div class="name_map" id="<h:outputText value="#{keys.key}"/>" lang="<h:outputText value="#{keys.key}"/>">
                                                <h:outputText value="#{keys.value} ;" styleClass="keyname"/>
                                                <div class="name_map_delete" lang="<h:outputText value="#{keys.key}"/>" ></div>
                                            </div>

                                        </a4j:repeat>
                                    </div>
                                    
                                </div>
                                <%--
                        <div class="fields_input send_to">
                              
                          
                            <h:selectOneMenu  value="#{m575Bean.fq100}" style="float:left;width:167px;height:28px;font-size:12px;" styleClass="person" >
                                <f:selectItem itemValue="1" itemLabel="#{locale.select_receiver}"/>
                                <f:selectItems value="#{m575Bean.selectItemQ100}"/>
                                <a4j:support event="onchange" reRender="tofrom,mapenty,mapform" actionListener="#{m575Bean.actionListenner}"/>
                            </h:selectOneMenu>
                        </div>--%>
                                <div class="fields_input">
                                    <label><h:outputText value="#{locale.title}"/>*:</label>
                                    <h:inputText value="#{m575Bean.mv576}" style="width:559px;height:23px;"/>
                                </div>                      

                                <div class="fields_input">
                                    <label><h:outputText value="#{locale.content}"/>:</label>
                                    <rich:editor viewMode="visual"
                                                 theme="advanced"
                                                 value="#{m575Bean.mv578}" height="150" width="564">
                                        <jsp:include page="../../common/EditorComponent.jsp"></jsp:include>
                                    </rich:editor>
                                </div>


                            </div>

                        </div>

                    </div>

                    <div class="popup-footer">

                        <h:outputText style="color:red; margin-left:275px" rendered="#{m575Bean.checksendmail}" value="Thư của bạn đã được gửi !"/>
                        <div class="buttonsave" onclick="self.parent.location='mail.jsp?action=clear'"  ><span><h:outputText value="#{locale.close}"/></span></div>
                        <h:commandButton onclick="showPleaseWait();"  action="#{m575Bean.saveM575}" value="#{locale.save}" styleClass="buttonsave">

                        </h:commandButton>
                        <rich:modalPanel id="ajaxLoadingModalBox" minHeight="30" minWidth="40"
                                         height="30" width="40" zindex="2000">
                            <h:outputText value="#{locale.please_wait}" styleClass="startDummer"></h:outputText>
                        </rich:modalPanel>

                    </div>

                </div>
            </body>
        </a4j:form>

    </f:view>
</html>
<script type="text/javascript">
    $j(document).ready(function(){
        yhight = ($j('.popup').height()-90)+"px" ;
        $j('.main_content').css('height',yhight );
        $j('.popup-content').css('height',yhight );
    });
</script>

